package com.bwie.utils;

/**
 * @Author: zhaijiaqi
 * @Date: 2025/7/15 10:33
 * @Description:
 **/
public class R {
    private Integer code;
    private String msg;
    private Boolean flag;
    private Object data;

    public static R ok(){
        R r = new R();
        r.setCode(200);
        r.setData(null);
        r.setFlag(true);
        r.setMsg("操作成功");
        return r;
    }

    public static R error(){
        R r = new R();
        r.setCode(500);
        r.setData(null);
        r.setFlag(true);
        r.setMsg("操作失败");
        return r;
    }

    public Integer getCode() {
        return code;
    }

    public R setCode(Integer code) {
        this.code = code;
        return this;
    }

    public String getMsg() {
        return msg;
    }

    public R setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public Boolean getFlag() {
        return flag;
    }

    public R setFlag(Boolean flag) {
        this.flag = flag;
        return this;
    }

    public Object getData() {
        return data;
    }

    public R setData(Object data) {
        this.data = data;
        return this;
    }
}
